package com.ficus.road.maintain.core.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Author hao.zhou1
 * @Since 2021/4/7 下午8:22
 */
@Data
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@NoArgsConstructor
@AllArgsConstructor
public class HistoryHitAttrs implements Serializable {
    // gps信息
    private GpsLocation gpsLocation;
    //状态
    private HitStatusEnum status;
    //car id
    private String carId;
    // 场景图
    private String sceneImage;

    // 场景图
    private String diseaseUid;

    // 描述
    private String description;

    //开始处置时间
    private Long startHandleTime;
    //结束处置时间
    private Long finishHandleTime;

    public static HistoryHitAttrs fromHitAttrs(HitAttrs attrs) {
        return HistoryHitAttrs.builder()
                .gpsLocation(attrs.getGpsLocation())
                .status(attrs.getStatus())
                .sceneImage(attrs.getSceneImage())
                .description(attrs.getDescription())
                .carId(attrs.getCarId())
                .diseaseUid(attrs.getDiseaseUid())
                .startHandleTime(attrs.getStartHandleTime())
                .finishHandleTime(attrs.getFinishHandleTime())
                .build();
    }
}
